package com.example.security.service;

import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 */
@Service
public class HelloService {

    @PreAuthorize("hasRole('ROLE_admin')")
    public String admin() {
        return "hello admin";
    }

    @Secured("ROLE_user")
    public String user() {
        return "hello user";
    }

    @PreAuthorize("hasAnyRole('ROLE_user','ROLE_admin')")
    public String hello() {
        return "hello hello";
    }

}
